package com.lora.judge.type;

import com.lora.judge.CheckModel;

import java.math.BigDecimal;

/**
 * 等于比较
 * target = source 返回 false 表示到达预警值，验证失败
 */
public class EqCheck extends CheckModel {

    private static EqCheck check;
    private EqCheck() {}
    public static EqCheck getInstance() {
        if(check == null) {
            check = new EqCheck();
        }
        return check;
    }

    @Override
    public boolean checkDate() {
        return false;
    }

    @Override
    public boolean checkDateTime() {
        return false;
    }

    @Override
    public boolean checkInt() {
        return !(((int) this.target) == ((int) this.source));
    }

    @Override
    public boolean checkLong() {
        return false;
    }

    @Override
    public boolean checkBigDecimal() {
        return !(((BigDecimal) this.target).doubleValue() == ((BigDecimal) this.source).doubleValue());
    }

    @Override
    public boolean checkString() {
        return !((String)this.target).equalsIgnoreCase((String)this.source);
    }

}
